<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>元素的堆叠顺序</title>
    <style>
        .box1{
            width: 200px;
            height: 200px;
            background-color: red;
            position:absolute;
            top: 100px;
            left:100px;
        }
        .box2{
            width: 200px;
            height: 200px;
            background-color: rgb(129, 195, 83);
            position: absolute;
            top: 150px;
            left:150px;
            z-index: 1
        }
        .box3{  
            width: 200px;
            height: 200px;
            background-color: rgb(102, 224, 175);
            position: absolute;
            top: 200px;
            left:200px;
            z-index: 2
        }
        .box4{
            width: 200px;
            height: 200px;
            background-color: rgb(116, 173, 230);
            position: absolute;
            top: 250px;
            left:250px;
            z-index: 3
        }
    </style>
</head>
<body>
    <div>
        <p>Z-index 属性，是设置元素的堆叠顺序的。用偶更高堆叠顺序的元素总是会处于堆叠顺序较低的元素的前面。</p>
    </div>
    <div>
        <div class="box1">1</div>
        <div class="box2">2</div>
        <div class="box3">3</div>
        <div class="box4">4</div>
    </div>
</body>
</html>